//
//  MyAdressListTableViewCell.m
//  GLGW_Shoping
//
//  Created by yang on 2018/11/28.
//  Copyright © 2018年 yang. All rights reserved.
//

#import "MyAdressListTableViewCell.h"

@interface MyAdressListTableViewCell ()
@property (nonatomic,strong) GLGWLabel * namePhoneLabel;
@property (nonatomic,strong) GLGWLabel * moRenLabel;
@property (nonatomic,strong) GLGWLabel * adressInforLabel;

@end

@implementation MyAdressListTableViewCell{
    
}

-(instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{
    if (self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]) {
        [self setSepartionLineWith:lineModel_Half];
        //
        self.namePhoneLabel = [[GLGWLabel alloc] initWithFont:SYSTEMFONT(16) theColor:kColor_Rule_Black inSuperView:self.contentView];
        self.namePhoneLabel.text = @"王毅   186****0000";
        [self.namePhoneLabel mas_makeConstraints:^(MASConstraintMaker *make) {
            make.left.equalTo(self.contentView.mas_left).offset(kWidthProportion_In_iPhoneTriploid(15));
            make.top.equalTo(self.contentView.mas_top).offset(kHeightProportion_In_iPhoneTriploid(20));
            make.height.equalTo(@(kHeightProportion_In_iPhoneTriploid(22)));
        }];
        //
        self.moRenLabel = [[GLGWLabel alloc] initWithFont:SYSTEMFONT(10) theColor:[UIColor whiteColor] inSuperView:self.contentView];
        self.moRenLabel.backgroundColor = kColor_Rule_Yellow;
        self.moRenLabel.text = @"默认";
        self.moRenLabel.textAlignment = NSTextAlignmentCenter;
        self.moRenLabel.layer.cornerRadius = kHeightProportion_In_iPhoneTriploid(7);
        self.moRenLabel.layer.masksToBounds = YES;
        [self.moRenLabel mas_makeConstraints:^(MASConstraintMaker *make) {
            make.left.equalTo(self.namePhoneLabel.mas_right).offset(kWidthProportion_In_iPhoneTriploid(8));
            make.centerY.equalTo(self.namePhoneLabel);
            make.width.equalTo(@(kWidthProportion_In_iPhoneTriploid(35)));
            make.height.equalTo(@(kHeightProportion_In_iPhoneTriploid(14)));
        }];
        //
        self.adressInforLabel = [[GLGWLabel alloc] initWithFont:SYSTEMFONT(14) theColor:[UIColor colorWithHexString:@"#666666"] inSuperView:self.contentView];
        self.adressInforLabel.text = @"北京市朝阳区左家庄中街23号 ";
        [self.adressInforLabel mas_makeConstraints:^(MASConstraintMaker *make) {
            make.left.equalTo(self.namePhoneLabel);
            make.top.equalTo(self.namePhoneLabel.mas_bottom).offset(kHeightProportion_In_iPhoneTriploid(12));
            make.right.equalTo(self.contentView.mas_right).offset(-kWidthProportion_In_iPhoneTriploid(45));
        }];
        //
        GLGWButton * editBut = [[GLGWButton alloc] initInSuperView:self.contentView];
        editBut.image_Name = @"adress_xiugai";
        [editBut mas_makeConstraints:^(MASConstraintMaker *make) {
            make.right.equalTo(self.contentView.mas_right).offset(0);
            make.top.equalTo(self.contentView.mas_top).offset(kHeightProportion_In_iPhoneTriploid(40));
            make.width.equalTo(@(kWidthProportion_In_iPhoneTriploid(45)));
            make.height.equalTo(@(kHeightProportion_In_iPhoneTriploid(45)));
        }];
        [editBut addTarget:self action:@selector(edit_Action) forControlEvents:UIControlEventTouchUpInside];
    }
    return self;
}

-(void)edit_Action{
    if (self.Block_EditAction) {
        self.Block_EditAction();
    }
}

-(void)setAdressInforModel:(MyAdressModel_Infos *)adressInforModel{
    _adressInforModel = adressInforModel;
    self.namePhoneLabel.text = [NSString stringWithFormat:@"%@   %@",koString(_adressInforModel.consignee),koString(_adressInforModel.tel)];
    if (_adressInforModel.sign == 1) {
        self.moRenLabel.hidden = NO;
    }else{
        self.moRenLabel.hidden = YES;
    }
    //
    self.adressInforLabel.text = _adressInforModel.address;
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
